/**
 * \brief Metaprogram for inversing elements in the table.
 *
 * \author Bartosz Kedra (bartosz.kedra@gmail.com)
 */
#include <iostream>

template <typename T> void ArrayInverse(T *first, T *last)
{
   if (first < last)
   {
      T temp = *first;
      *first = *last;
      *last = temp;
      ArrayInverse<T>(++first, --last);
   }
}

int main()
{
   int tab[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
   int tab_el_nr = sizeof(tab) / sizeof(tab[0]);

   ArrayInverse<int>(tab, &tab[tab_el_nr - 1]);

   for (int i = 0; i < tab_el_nr; i++)
   {
      std::cout << tab[i] << " " ;
   }
}
